package Tank1;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class GameWindow extends Frame{
	Tank t1 = new Tank();
	Tank t2 = new Tank(200,200);
	Tank t3 = new Tank(400,400,50,50,10,Toolkit.getDefaultToolkit().getImage("src\\images\\tankD_red.gif"));

	public static void main(String[] args){
		GameWindow gw = new GameWindow();
	
		gw.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){
				System.exit(0);
			}
		});
		
		gw.startFrame();



	}

	private void startFrame() {
		// TODO Auto-generated method stub
		this.setSize(800,600);
		this.setVisible(true);
		
//		while(true){
//			repaint();
//			try {
//				Thread.sleep(100);
//			} catch (InterruptedException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
//		}
		new PaintThread().start();

		
	}
	
	public void paint(Graphics g){
		t1.paint(g);
		t2.paint(g);
		t3.paint(g);
		t3.move();
		t1.move();
	}

	class PaintThread extends Thread{

		@Override
		public void run() {
			// TODO Auto-generated method stub
			super.run();
			while(true){
				repaint();
				try {
					Thread.sleep(100);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
		
	}
}
